package edu.xmut.kakamusic.viewmodel.mine;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.Transformations;
import androidx.lifecycle.ViewModel;

import com.github.leonardoxh.livedatacalladapter.Resource;

import java.util.List;
import java.util.Map;

import edu.xmut.kakamusic.bean.vo.HotSongVO;
import edu.xmut.kakamusic.bean.vo.UserInfoVO;
import edu.xmut.kakamusic.utils.ApiResponse;
import edu.xmut.kakamusic.utils.RequestUtils;

public class MineMusicViewModel extends ViewModel {
    public LiveData<ApiResponse<List<HotSongVO>>> getHosSong(String token, Integer currentPage, Integer pageSize) {
        return Transformations.map(RequestUtils.getInstance().getHotSong(token, currentPage, pageSize), Resource::getResource);
    }

    public LiveData<ApiResponse<UserInfoVO>> getUserInfo(String token) {
        return Transformations.map(RequestUtils.getInstance().getUserInfo(token), Resource::getResource);
    }

}
